<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        //声明一个数组
        var arr = [2, 6, 0, 1, 77, 52, 27, 7, 25];
        // 声明一个空数组
        var newArr = [];
        // 数组下标
        var index = 0;
        // 开始遍历
        for (var i = 0; i < arr.length; i++) {
            // 如果数组里的值>=10，赋值给新数组
            if (arr[i] > 10) {
                newArr[index] = arr[i];
                index++;
            }
        }
        console.log(newArr);
        console.log('--------------------------');

        //声明一个数组
        var arr = [2, 6, 0, 1, 77, 52, 27, 7, 25];
        // 声明一个空数组
        var newArr = [];
        for (var i = 0; i < arr.length; i++) {
            if (arr[i] >= 10) {
                newArr[newArr.length] = arr[i];
            }
        }
        console.log(newArr);
        console.log('--------------------------');
        for (var i = 0; i < arr.length; i++) {
            if (arr[i] > 10) {
                newArr[index] = arr[i];
                index++;
            }
        }
        console.log(newArr);
        console.log('--------------------------');
    </script>
</body>

</html>